/*
 * @Author: xuwejie 1529315455@qq.com
 * @Date: 2023-08-28 14:39:13
 * @LastEditors: xuwejie 1529315455@qq.com
 * @LastEditTime: 2024-01-24 11:48:34
 * @FilePath: \v9\src\main.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Vue from "vue";

import "normalize.css/normalize.css"; // A modern alternative to CSS resets

import ArmsRum from '@arms/rum-browser';
ArmsRum.init({
  "pid": "a3oe6ybfvk@804737d1170a586",
  "endpoint": "https://a3oe6ybfvk-default-cn.rum.aliyuncs.com"
});

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import "default-passive-events";

import "@/styles/index.scss"; // global css
import $myConfirm from "./components/myConfirm";

import App from "./App";
import store from "./store";
import router from "./router";
import directive from "@/utils/directive.js";
import * as filters from "@/utils/filters.js";
import { roundFloat } from "@/utils/math.js";
import _ from 'lodash'



Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key]);
});


import "@/icons"; // icon
import "@/permission"; // permission control
import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'

import intro from 'intro.js' // introjs库
import 'intro.js/introjs.css' // introjs默认css样式
// introjs还提供了多种主题，可以通过以下方式引入
import 'intro.js/themes/introjs-modern.css' // introjs主题
import '@/styles/newIndex.scss'
import "@/styles/animate.min.css";


// 加到prototype中，直接通过vue实例就能调用intro了
Vue.prototype.$intro = intro
Vue.use(VXETable)
Vue.prototype.$VXETable = VXETable

import { getToken } from "@/utils/auth";
Vue.prototype.getToken = getToken;

Vue.use(ElementUI, { size: "small" });
Vue.use(directive);
Vue.use($myConfirm);
// 全局组件
import ChangeGoodsInput from "@/components/ChangeGoodsInput";
Vue.component("ChangeGoodsInput", ChangeGoodsInput);

import ChangeUserInput from "@/components/ChangeUserInput";
Vue.component("ChangeUserInput", ChangeUserInput);

import TableHeaderSetting from "@/components/TableHeaderSetting";
Vue.component("TableHeaderSetting", TableHeaderSetting);

import ProgressDiolog from "@/components/ProgressDiolog";
Vue.component("ProgressDiolog", ProgressDiolog);

import NewChangeGoodsInput from "@/components/NewChangeGoodsInput";
Vue.component("NewChangeGoodsInput", NewChangeGoodsInput);

// 表格头回调韩式添加竖线
Vue.prototype.$verticaline = function ({ row, column, rowIndex, columnIndex }) {
  if (columnIndex != 0 && columnIndex != row.length - 1) {
    return "verticaline";
  }
};

// 全局四舍五入方法
// Vue.prototype.$toFixed = function(number, precision = 2) {
//   const func = Math.round;
//   var _sign = number < 0 ? -1 : 1;
//   precision == null
//     ? 0
//     : precision >= 0
//     ? Math.min(precision, 292)
//     : Math.max(precision, -292);
//   if (precision) {
//     let pair = `${number}e`.split("e");
//     const value =
//       func(`${pair[0] * _sign}e${+pair[1] + precision + 12}`) * _sign;
//     pair = `${value}e`.split("e");
//     let result = +`${pair[0]}e${+pair[1] - precision - 12}`;
//     result = Math.round(result * 100) / 100;
//     return result.toFixed(2);
//   }
//   return func(number);
// };
Vue.prototype._ = _
Vue.prototype.$toFixed = function (number, precision = 2) {
  return roundFloat(number, precision);
};

Vue.config.productionTip = false;
//  全局引入分页组件
import MainPagination from '@/components/MainPagination'
Vue.component('MainPagination', MainPagination);
//  全局引入表单搜索按钮组件
import MainFormBtn from '@/components/MainFormBtn'
Vue.component('MainFormBtn', MainFormBtn);
import MainTable from '@/components/MainTable/table.vue'
Vue.component('MainTable', MainTable);
import MainDialog from '@/components/MainDialog/dialog.vue'
Vue.component('MainDialog', MainDialog);
import MainLink from '@/components/MainLink/link.vue'
Vue.component('MainLink', MainLink);
//  表单组件
import MainSearchForm from '@/components/MainSearchForm/searchForm.vue'
Vue.component('MainSearchForm', MainSearchForm);


new Vue({
  el: "#app",
  router,
  store,
  render: h => h(App)
});
